-
Notifications
You must be signed in to change notification settings - Fork 82
Described virtual products and added an example creating product type with PHP API #3024
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 4.6
Are you sure you want to change the base?
Conversation
0a5f8e5 to
6561d43
Compare
Preview of modified filesPreview of modified Markdown: |
|
|
||
| $marketingDescriptionFieldDefinition = $this->contentTypeService->newFieldDefinitionCreateStruct( | ||
| 'marketing_description', | ||
| 'ezstring' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self: on upmerge, this should be ibexa_string
...i_reference/input/examples/product/catalog/product_types/POST/ProductTypeCreate.json.example
Outdated
Show resolved
Hide resolved
...t_api_reference/input/examples/product/catalog/product_types/id/GET/ProductType.json.example
Outdated
Show resolved
Hide resolved
Co-authored-by: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com>
code_samples/ change report
|
adriendupuis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't straiten developers to virtual as being only digital.
| Product types in [[= product_name =]] can be either virtual or physical: | ||
|
|
||
| - **Physical products** are tangible items that require shipping (for example: books, clothing, electronics). | ||
| - **Virtual products** are digital items that don't require physical delivery (for example: software licenses, e-books, online courses, digital downloads). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree with "digital" here. There are some examples that are at the edge, nothing is shipped this time but could have been already shipped ("subscription renewal" of a GPS device, of an e-reader device, internet box TV programs, …), or it can become physical when needed ("Additional X years insurance or warranty" with product replacement or loan of the similar product during the repairs, …), it can be a virtual tokken giving access to physical product ("spectacle ticket", "virtual gift card" for recipient to buy real products,…). Let's not focus on "digital" and see usages that can be invented.
| - **Virtual products** are digital items that don't require physical delivery (for example: software licenses, e-books, online courses, digital downloads). | |
| - **Virtual products** are items that don't require physical delivery (for example: software licenses, e-books, online courses, digital downloads, additional warranty, tickets for an event). |
(No issue in the fact that the example is a digital product.)
| This product type property affects the checkout process. | ||
| Virtual products skip the [shipping step](shipping_management.md) during checkout. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would avoid confusion here, their presence doesn't "force skip".
| This product type property affects the checkout process. | |
| Virtual products skip the [shipping step](shipping_management.md) during checkout. | |
| This product type property can affect the checkout process. | |
| A cart of only virtual products skips the [shipping step](shipping_management.md) during checkout. |
| [[= include_file('code_samples/api/product_catalog/src/Command/ProductTypeCommand.php', 67, 71) =]] | ||
| ``` | ||
|
|
||
| To create a virtual product type (for digital products that don't require shipping), use `setVirtual()`: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| To create a virtual product type (for digital products that don't require shipping), use `setVirtual()`: | |
| To create a virtual product type (for products that don't require shipping), use `setVirtual()`: |
| For more information about working with attributes through PHP API, see [Attributes](#attributes). | ||
|
|
||
| Finally, create the product type with `LocalProductTypeServiceInterface::createProductType()`: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this not part of "Assigning attributes" section, I would add a new heading:
| For more information about working with attributes through PHP API, see [Attributes](#attributes). | |
| Finally, create the product type with `LocalProductTypeServiceInterface::createProductType()`: | |
| For more information about working with attributes through PHP API, see [Attributes](#attributes). | |
| #### Storing new product type | |
| Finally, create the product type with `LocalProductTypeServiceInterface::createProductType()`: |
|
|
||
| To assign product attributes to the product type, use `setAssignedAttributesDefinitions()` with an array of [`AssignAttributeDefinitionStruct`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Local-Values-ProductType-AssignAttributeDefinitionStruct.html) objects. | ||
|
|
||
| First, retrieve the attribute definition using [`AttributeDefinitionServiceInterface`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-AttributeDefinitionServiceInterface.html): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| First, retrieve the attribute definition using [`AttributeDefinitionServiceInterface`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-AttributeDefinitionServiceInterface.html): | |
| First, retrieve the attribute definition by using [`AttributeDefinitionServiceInterface`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-AttributeDefinitionServiceInterface.html): |
"using" alone could be interpreted as "that uses"
Instead of "by using" you could use "with"
|
I would add a link somewhere that binds dev doc with user doc by pointing to: |
@mnocon And I discover that the user doc doesn't have the "digital" bias and even quotes examples I was thinking of. 😉 |
Doc for https://ibexa.atlassian.net/browse/IBX-10630
Turns out we didn't have virtual products mentioned at all in the doc, so I'm adding a mention to the product guide.
Code tested locally: